<?php namespace App\Commands;

use App\Commands\Command;

use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldBeQueued;

use Log;
use Ender\YunPianSms\SMS\YunPianSms;

class SendSMS extends Command implements SelfHandling, ShouldBeQueued {

	use InteractsWithQueue, SerializesModels;

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
	}

	/**
	 * Execute the command.
	 *
	 * @return void
	 */
	public function handle()
	{
	}

	public function fire($job, $data)
	{
		$yunpianSms = new YunPianSms(env("SMS_APPKEY"));
		$response = $yunpianSms->sendMsg($data["number"], $data["msg"]);
		Log::info($response);
		return $response;
	}
}
